<?php

//1
$member['username']="mukewang";
$member['password']="mukewang";
$do = $_REQUEST['do'];


//2
$members['1']['username']="慕课网";
$members['1']['password']="mukewang";
$members['2']['username']="张三";
$members['two']['password']="zhang";
$members['two']['address']="北京";


//3
class addressClass{
	public $address=array();

	public function setAddress($array){
		$this->address=$array;
	}

	public function getAddress(){
		return $this->address;
	}
}


$addressObj = new addressClass;

$addressObj->setAddress($members);

switch ($do) {
	case 'first':
		echo json_encode($member);
		break;
	case 'second':
		echo json_encode($members);
		break;
	case 'third':
		echo json_encode($addressObj);
		break;
}




?>